Skip to content

Add necessary files for OPCUA ioc build #919

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

esmith1729
Copy link
Contributor

@esmith1729 esmith1729 commented Mar 25, 2025

Description of work

OPCUA IOC module that should be general purpose, for other OPC servers that need an IOC configuration.

OPCUA_01.cmd should be placed in C:\Instrument\Settings\config\[instrument name]\configurations\opcua folder, alongside a private key found on the network shares

To test

  • Please confirm that this builds and runs correctly with the OPC PLC on MAPS, and that the OPCUA module looks accurately like other EPICS IOCs (this is my first time porting a new module to EPICS like this).

  • You will need to copy the opcua\MAPS_OPCUA\ folder from the non-public shares into your config ...\<NDW###\configurations\ copy and paste the folder there and name it opcua so it can get pickup up by the IOC. Only copy the MAP_OPCUA folder itself and rename it.

  • MAPS: Provide support to read pressure values from vacuum PLC IBEX#8586

Acceptance criteria

  • The IOC builds and can run properly (it connects to the MAPS PLC and reads values accurately. There should be two TPG-like OPIs displayed (the OPI is called MAPS-OPC-Server

Code Review

Functional Tests

  • IOC responds correctly in:
    • Devsim mode
    • Recsim mode
    • Real device, if available
  • Supplementary IOCs (..._0n where n>1) run correctly
  • Log files do not report undefined macros (serach for macLib: macro to find instances of macLib: macro [macro name] is undefined...

Final steps

  • Update the IOC submodule in the main EPICS repo. See Git workflow page for details.
  • Reviewer has merged the associated PR for the release notes

Copy link
Contributor

@Tom-Willemsen Tom-Willemsen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • There's a lot of example code in this PR which makes it a bit tricky to review - could we cut down this IOC to the bits we're actually using? I think probably the entire exampleTop directory can go.
  • Please add some documentation on the wiki. I think we probably need two pages:
    • One for OPCUA in general (e.g. write the documentation to help someone who is configuring a new OPCUA device on another instrument). Example topics:
      • How is authentication being handled?
      • Do any settings in the PLC side need adjusting to get communicating properly?
      • Where are instrument-specific configs loaded from (looks like opcua folder in configs area, but please document this)
      • Where are instrument-specific DBs defined
      • Any troubleshooting information you know of - e.g. what errors have you seen during the course of development and how were they resolved?
      • As a supporter / on-call person, what would I need/want to know if I get a call saying communication with an OPCUA server isn't working?
    • One for the MAPS vacuum system in particular, describing the operation/code behind the MAPS vacuum. No need to repeat the generic OPCUA IOC information here, link to the page above, just describe what is specific for MAPS' implementation.
      • As a supporter / on-call person, what would I need/want to know if I get a call saying communication with MAPS' vacuum system isn't working?
    • I think both of these pages are sub-pages under the PLCs section of the docs
  • Please add release notes

Comment on lines +4 to +5
opcuaOptions OPC1 sec-mode=None, sec-id="\Instrument\Settings\config\NDW2548\configurations\opcua\cert.txt", debug=10
opcuaClientCertificate "C:\Instrument\Settings\config\NDW2548\configurations\opcua\client_cert.der", "C:\Instrument\Settings\config\NDW2548\configurations\opcua\client_private_key.pem"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you use the ICPCONFIGROOT macro or similar here, so that we're not hard-coding machine names?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I can tell this DB is specific for MAPS' vacuum system - I'd suggest a name something like maps_vacuum_tpg1 for this DB perhaps?

Just thinking ahead to if/when we get more of these DBs for PLCs on other instruments.

Comment on lines +49 to +55
record(stringin, "$(P)$(R):PE_UNDERRANGE") {
field(DTYP, "OPCUA")
field(INP, "@$(SUBS) ns=4;s=Opc_TPG1_Statuses.PE_Underrange_Control")
field(SCAN, "I/O Intr")
field(TSE, "-2")
field(TPRO, "$(DEBUG=0)")
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional: since all the rest of the records in this file are basically identical to each other just with different type/name/opcua string, you could probably clean this up quite significantly using templates+substitutions.

##ISIS## Stuff that needs to be done after all records are loaded but before iocInit is called
< $(IOCSTARTUP)/preiocinit.cmd

#! $(SUPPORT)/OPCUA/bin/windows-x64/opcua
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't look right - are you sure?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Binaries should not be committed to the repo.

But see comment elsewhere - maybe we get rid of the whole exampleTop folder?


# IOC-specific support module
OPCUA=$(SUPPORT)/OPCUA/master
TPG=$(SUPPORT)/TPG/master
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: newline at eof

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to have a huge amount in common with server-1.db.

Can we use a header for the few records that are only in server-1, and then load the same DB twice but with different macros to avoid the duplication? Or use template/substitutions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MAPS: Provide support to read pressure values from vacuum PLC
2 participants